package com.jhgk.jhcee.system.controller;

import com.jhgk.jhcee.common.resultful.BasisResultful;
import com.jhgk.jhcee.system.domain.model.SysRoleInfoModel;
import com.jhgk.jhcee.system.service.SysRoleInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description:
 * @Author: lemon_xzp
 * @Date: 2021/9/19 22:50
 */
@RestController
@RequestMapping("/role")
@Api(value = "角色信息", tags = {"角色信息"})
public class SysRoleInfoController {

    @Resource(name = "SysRoleInfoServiceImpl")
    SysRoleInfoService sysRoleInfoService;

    @PostMapping("/roleAllList")
    @ApiOperation("条件分页查询角色信息")
    public BasisResultful<Object> roleAllList(@RequestBody SysRoleInfoModel sysRoleInfoModel) {
        return sysRoleInfoService.roleAllList(sysRoleInfoModel);
    }

    @GetMapping("/getRoleAll")
    @ApiOperation("获取所有角色信息——不分页")
    public BasisResultful<Object> getRoleAll() {
        return sysRoleInfoService.getRoleAll();
    }

    @PostMapping("/addRole")
    @ApiOperation("新增角色信息")
    public BasisResultful<Object> addRole(@RequestBody SysRoleInfoModel sysRoleInfoModel) {
        return sysRoleInfoService.addRole(sysRoleInfoModel);
    }

    @PutMapping("/updateRole")
    @ApiOperation("更新角色信息")
    public BasisResultful<Object> updateRole(@RequestBody SysRoleInfoModel sysRoleInfoModel) {
        return sysRoleInfoService.updateRole(sysRoleInfoModel);
    }

    @DeleteMapping("/deleteRole")
    @ApiOperation("删除角色信息")
    public BasisResultful<Object> deleteRole(@RequestBody SysRoleInfoModel sysRoleInfoModel) {
        return sysRoleInfoService.deleteRole(sysRoleInfoModel);
    }

    @PutMapping("/setRoleStatus")
    @ApiOperation("设置角色状态")
    public BasisResultful<Object> setRoleStatus(@RequestBody SysRoleInfoModel sysRoleInfoModel) {
        return sysRoleInfoService.setRoleStatus(sysRoleInfoModel.getRoleId(), sysRoleInfoModel.getStatus());
    }

}
